<?php 
if(!function_exists('___categoryTreeList')) {
	function ___categoryTreeList($tree, $selectedId = '', $level = 0) {
		$str = "";
		foreach($tree AS $row) {
			$str .= '<option value="' . $row['id'] . '"';
			if($row['id'] == $selectedId) {
				$str .= ' selected="selected"';
			}
			$str .= '>» ' . str_repeat('&nbsp;', ($level * 6)) . htmlspecialchars($row['title']) . ' [' . $row['id'] . ']</option>';
			if(!empty($row['children'])) {
				$str .= ___categoryTreeList($row['children'], $selectedId, ($level + 1));
			}
		}
		return $str;
	}
}
$selectedId = isset($this->selectedId) ? $this->selectedId : 0;
$name = isset($this->name) ? $this->name : 'category_id';
echo '<select name="' . $name . '" id="' . $name . '">';
echo '<option value="0">== ' . $this->language('SELECT') . ' ==</option>';
echo ___categoryTreeList(picture_category::allCategoryToTreeAsArray(), $selectedId);
echo '</select>';
?>